package mechanism.classinit;

public class Sub extends Base {
	
	String str3 = "I am str3";

	@Override
	 // 由于基类中的构造方法调用了重写前的init()，所以此方法会比本类的构造函数先运行
	protected void init() {
		str1 = "Sub init str1";
		str2 = "Sub init str2";
		str3 = "Sub init str3";
	}
	
	@Override
	public String toString() {
		return super.toString() + "\nstr3 = " + str3;
	}
	
	public static void main(String[] args) {
		System.out.println(new Sub());
	}
}
